package cn.finyzq.ss.games.vo;

import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * Create Time: 2018年08月05日 12:30
 *
 * @author fin
 */
@Data
public class Room {

    public static final int READY = 0;
    public static final int PLAYING = 1;
    public static final int CLOSE = 2;

    public static final int PAINT = 0;
    public static final int BLACK = 1;

    /**
     * 房间号
     */
    private String roomNo;

    /**
     * 参与者
     */
    private List<Player> participants = new ArrayList<>();


    /**
     * 房间状态 0：准备 1：已开始 2：已关闭
     */
    private int roomStatus;

    /**
     * 游戏类型 0：你画我猜 1：谁是卧底 2：其他
     */
    private int gameType;

    /**
     * 房主 包含在参与者中
     */
    private User owner;

    public boolean existUser(User user) {
        for (User participant : participants) {
            if(participant.getOpenid().equals(user.getOpenid())){
                return true;
            }
        }
        return false;
    }

    public void addParticipant(Player user) {
        participants.add(user);
    }
}
